import { invoiceTypeList } from '@/enums/spuEnum';
import { BasicColumn, FormSchema } from '@/components/Table';

const enableOptions = [
  { label: '启用', value: 1 },
  { label: '停用', value: 0 },
];

export const tableColumns: BasicColumn[] = [
  { title: '编号', dataIndex: 'id' },
  {
    title: '类型',
    dataIndex: 'type',
    customRender: ({ text }) => {
      return invoiceTypeList.find((find) => find.value === text)?.label;
    },
  },
  { title: '税点（%）', dataIndex: 'tax' },
  { title: '状态', dataIndex: 'enable', slots: { customRender: 'enable' } },
];
export const tableFormSchema: FormSchema[] = [
  // {
  //   field: 'type',
  //   label: '类型',
  //   component: 'Select',
  //   colProps: { span: 6 },
  //   componentProps: {
  //     options: invoiceTypeList,
  //   },
  // },
  {
    field: 'enable',
    label: '状态',
    component: 'Select',
    colProps: { span: 6 },
    componentProps: {
      options: enableOptions,
    },
  },
];

export const modalFormSchema: FormSchema[] = [
  {
    required: true,
    field: 'type',
    label: '类型',
    component: 'Select',
    componentProps: {
      options: invoiceTypeList,
    },
  },
  {
    required: true,
    field: 'tax',
    label: '税点（%）',
    component: 'InputNumber',
    componentProps: {
      min: 0,
    },
  },
];
